package cn.edu.dgut.css.springboottest2.Event;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationListener;

/**
 * @Author:GooGa
 * @Data:2020/11/1 22:43
 */
public class NoticeListener implements ApplicationListener<NoticeEvent> {

    private static final Logger logger = LoggerFactory.getLogger(NoticeListener.class);

    @Override
    public void onApplicationEvent(NoticeEvent noticeEvent) {

        logger.info("监听到NoticeEvent事件 , 睡眠当前线程1s");

        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        logger.info("NoticeEvent中的message是 ： {}", noticeEvent.getMessage());

    }

}